Attribute VB_Name = "modsavemodule"
Private Const autoSaveFileName As String = "autosave.dat"

Private Function GetAutoSaveFilePath() As String
    GetAutoSaveFilePath = App.Path & IIf(Right$(App.Path, 1) = "\", "", "\") & autoSaveFileName
End Function



Public Sub SaveMailData()
    Dim filenumbers As Integer
    Dim filepaths As String
    Dim folderpath As String
    Dim FilePath As String
    Dim datas As String

    filenumbers = FreeFile

    Open App.Path & "SAVE.DAT" For Input As #filenumbers
    Input #filenumbers, filepaths
    Close #filenumbers

    folderpath = filepaths
    FilePath = folderpath & "\" & "mail_" & Format(Now, "yy/MM/dd_HHmm") & ".dat"
    datas = inboxform.Text3.Text & "," & inboxform.Text2.Text & "," & inboxform.Text1.Text & "," & inboxform.Text4.Text
    filenumbers = FreeFile
    Open FilePath For Append As #filenumbers
    Print #filenumbers, datas
    Close #filenumbers
End Sub


Public Sub SaveAutoSaveSetting(ByVal enabled As Boolean)
    Dim fnum As Integer
    On Error Resume Next
    fnum = FreeFile
    Open GetAutoSaveFilePath() For Output As #fnum
        Write #fnum, IIf(enabled, 1, 0)
    Close #fnum
End Sub


